<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]>      <html class="no-js"> <!--<![endif]-->
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="">
  </head>
  <body>
    <!--[if lt IE 7]>
      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->
    
    <script>
   let tableArr = [
    //  行
    {
        "children": [

            {
                "children": [
                    {
                        "hasSpan": true,
                        "spanHtml": "<span>编号</span>",
                        "style": "text-align: center; hyphenate: auto; font-family: 黑体; font-size: 16pt"
                    }
                ],
                "style": "width: 0.7486111in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": false,
                        "formDataAttr": []
                    }
                ],
                "style": "width: 0.7486111in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": true,
                        "spanHtml": "<span>来文单位</span>",
                        "style": "text-align: center; hyphenate: auto; font-family: 黑体; font-size: 16pt"
                    }
                ],
                "style": "width: 1.1618055in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": false,
                        "formDataAttr": [
                            {
                                "type": "input",
                                "typeName": "文本输入框",
                                "label": "文本输入框",
                                "fieldName": "文本输入框",
                                "icon": "danhangwenben1",
                                "span": 24,
                                "disabled": false,
                                "required": false,
                                "visible": true,
                                "value": "sssss",
                                "defaultValue": "",
                                "maxLength": 50,
                                "remindText": "",
                                "placeholder": "",
                                "putMessageBack": false,
                                "isRelatedSubform": false,
                                "textRules": 0,
                                "prop": "1648886276903_63416"
                            }
                        ]
                    }
                ],
                "style": "width: 1.9965278in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": true,
                        "spanHtml": "<span>文号</span>",
                        "style": "text-align: center; hyphenate: auto; font-family: 黑体; font-size: 16pt"
                    }
                ],
                "style": "width: 0.79444444in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": false,
                        "formDataAttr": []
                    }
                ],
                "style": "width: 0.8277778in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            }
        ],
        "style": "height: 0.46666667in; keep-together: always",
        "rowspan": null,
        "colspan": null
    },
    {
        "children": [
            {
                "children": [
                    {
                        "hasSpan": true,
                        "spanHtml": "<span>密级</span>",
                        "style": "text-align: center; hyphenate: auto; font-family: 黑体; font-size: 16pt"
                    }
                ],
                "style": "width: 0.7486111in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": false,
                        "formDataAttr": []
                    }
                ],
                "style": "width: 0.7486111in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": true,
                        "spanHtml": "<span>收文日期</span>",
                        "style": "text-align: center; hyphenate: auto; font-family: 黑体; font-size: 16pt"
                    }
                ],
                "style": "width: 1.1618055in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": false,
                        "formDataAttr": []
                    }
                ],
                "style": "width: 1.9965278in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": true,
                        "spanHtml": "<span>份数</span>",
                        "style": "text-align: center; hyphenate: auto; font-family: 黑体; font-size: 16pt"
                    }
                ],
                "style": "width: 0.79444444in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": false,
                        "formDataAttr": []
                    }
                ],
                "style": "width: 0.8277778in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            }
        ],
        "style": "height: 0.46666667in; keep-together: always",
        "rowspan": null,
        "colspan": null
    },
    {
        "children": [
            {
                "children": [
                    {
                        "hasSpan": true,
                        "spanHtml": "<span>标题</span>",
                        "style": "text-align: center; hyphenate: auto; font-family: 黑体; font-size: 16pt"
                    }
                ],
                "style": "width: 0.7486111in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": false,
                        "formDataAttr": []
                    }
                ],
                "style": "width: 5.5291667in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": "5"
            }
        ],
        "style": "height: 0.72847223in; keep-together: always",
        "rowspan": null,
        "colspan": null
    },
    {
        "children": [
            {
                "children": [
                    {
                        "hasSpan": true,
                        "spanHtml": "<span>拟办意见</span>",
                        "style": "text-align: center; hyphenate: auto; font-family: 黑体; font-size: 16pt"
                    }
                ],
                "style": "width: 0.7486111in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": false,
                        "formDataAttr": []
                    }
                ],
                "style": "width: 5.5291667in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": "5"
            }
        ],
        "style": "height: 1.5541667in; keep-together: always",
        "rowspan": null,
        "colspan": null
    },
    {
        "children": [
            {
                "children": [
                    {
                        "hasSpan": true,
                        "spanHtml": "<span>主要领导批示</span>",
                        "style": "text-align: center; hyphenate: auto; font-family: 黑体; font-size: 16pt"
                    }
                ],
                "style": "width: 0.7486111in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": false,
                        "formDataAttr": []
                    }
                ],
                "style": "width: 5.5291667in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": "5"
            }
        ],
        "style": "height: 1.9791666in; keep-together: always",
        "rowspan": null,
        "colspan": null
    },
    {
        "children": [
            {
                "children": [
                    {
                        "hasSpan": true,
                        "spanHtml": "<span>分管领导批示</span>",
                        "style": "text-align: center; hyphenate: auto; font-family: 黑体; font-size: 16pt"
                    }
                ],
                "style": "width: 0.7486111in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": false,
                        "formDataAttr": []
                    }
                ],
                "style": "width: 5.5291667in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": "5"
            }
        ],
        "style": "height: 1.7243055in; keep-together: always",
        "rowspan": null,
        "colspan": null
    },
    {
        "children": [
            {
                "children": [
                    {
                        "hasSpan": true,
                        "spanHtml": "<span>部门办理</span>",
                        "style": "text-align: center; hyphenate: auto; font-family: 黑体; font-size: 16pt"
                    }
                ],
                "style": "width: 0.7486111in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": null
            },
            {
                "children": [
                    {
                        "hasSpan": false,
                        "formDataAttr": []
                    }
                ],
                "style": "width: 5.5291667in; padding-start: 0in; padding-end: 0in; border-bottom: thin solid black; border-left: thin solid black; border-right: thin solid black; border-top: thin solid black",
                "rowspan": null,
                "colspan": "5"
            }
        ],
        "style": "height: 1.1868056in; keep-together: always",
        "rowspan": null,
        "colspan": null
    }
]

// 递归重置表格数组
 function resetTableArr(arr){    
   for(let i = 0;i<arr.length;i++){
      poll(arr[i]);
   }
  
   function poll(obj){
     if(obj.children && obj.children.length){
        for(let i=0; i< obj.children.length; i++){
          poll(obj.children[i])
        }
     }else{
       if(obj["formDataAttr"] && obj["formDataAttr"].length){
        obj["formDataAttr"].forEach(item=>{
          resetWidgetItem (item);
        })
       }
     }
   }

  return arr;
 }
    

 console.log(resetArr(tableArr ))
 function resetWidgetItem (item){
   let type = item.type;
    if(["text", "input", "textarea", "number","ckeditor" , "radio"].includes(type)){
      item.value = "";
    }
     if (type == "switch") {
       item.value = false;
     }

     if (["checkbox","select","tree", "address", "upload" ].includes(type)) {
       item.value = [];
     }
   
     if (type == "rate") {
       item.value = 0;
     }     
     if ( ["date", "time", "datetime" ].includes(type) ) {
       item.value = null;
     }
     
     if (type == "comment") {
     item.value = [{value:'', auditTime:'', auditPerson:''}];
     }
 }    
    
    </script>
  </body>
</html>